import pandas as pd

weak_tsv_file = "/nvmework1/shaonian/Datasets/DCASE/dcase2021/dataset/metadata/train/weak.tsv"

weak_df = pd.read_csv(weak_tsv_file, sep="\t")
train_weak_df = weak_df.sample(frac=0.9,random_state=1)

valid_weak_df = weak_df.drop(train_weak_df.index).reset_index(drop=True)
# save train and val 
train_weak_df.to_csv(
    "./train_weak.tsv",
    sep="\t",
    index=False
)
valid_weak_df.to_csv(
    "./valid_weak.tsv",
    sep="\t",
    index=False
)   